
let baseUrl='https://meituan.thexxdd.cn/api'
import {Base64} from 'js-base64'
function getToken(){
    const token = uni.getStorageSync("token")||''
    const base64_token = Base64.encode(token + ':')
    return 'Basic ' + base64_token
}

export function request(url,method,data,header){
	
	return new Promise((resolve,reject)=>{
	
		uni.request({
			url:baseUrl+url,
			method,
			data,
			header:{
				 "Authorization":getToken(),
				...header
			},
			success(res){
				resolve(res.data,)
			},
			fail(err){
				reject(err)
			}
		})
		
	})
	
}